package com.baosight.sczx.zm.cc.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.cc._5ExamineCondition;
import com.baosight.sczx.zm.cc.domain.ZMCC5examineConditionDetail;

/**
 * 五个到位考核 明细表
 * <p>Title: ServiceZMCC16.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 严洪浩
 * @version 1.0
 * <pre>Histroy:
 *          2011-7-4 上午09:01:18  严洪浩  Create
 *</pre>
 */
public class ServiceZMCC16 extends ServiceEPBase {
	
	/**
	 * 初始化
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS41</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-3上午05:31:26 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		return outInfo;
	}
	
	/**
	 * 查询
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCC01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-28上午02:33:54 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) {
		StaticTools.setQueryParameters(inInfo, "fdConditionId", inInfo.get("fdConditionId"), true);//添加查询条件
		EiInfo outInfo = super.query(inInfo, "ZMCC5examineConditionDetail.query", new ZMCC5examineConditionDetail());
		
		return outInfo;
	}
	
	/**
	 * 
	 * <p>Function: update</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCC01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-28上午02:33:40 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo update(EiInfo inInfo) {
		String fdConditionId = inInfo.getBlock("result").getCellStr(0, "fdConditionId");//主表ID
		EiInfo outInfo = super.update(inInfo, "ZMCC5examineConditionDetail.update");
		_5ExamineCondition.update5ExamineCondition(fdConditionId);
		return outInfo;
	}

	/**
	 * 
	 * <p>Function: delete</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCC01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-28上午02:33:32 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo delete(EiInfo inInfo) {
		EiInfo _temp = super.delete(inInfo, "ZMCC5examineConditionDetail.delete");
		EiInfo outInfo = this.query(inInfo);
	    outInfo.setMsg(_temp.getMsg());
	    outInfo.setDetailMsg(_temp.getDetailMsg());

		return outInfo;
	}
}
